<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>预算定制</title>
<%@include file="/common/meta.jsp"%>
<%@include file="/common/validator.jsp"%>
<style type="text/css">

.budgetTable {
	margin: auto;
	border-top: 1px solid #000000;
	border-left: 1px solid #000000;
}

.budgetTable tr td {
	height:25px;
	border-bottom: 1px solid #000000;
	border-right: 1px solid #000000;
	font-family: sans-serif;
}

.budgetTable tr th {
	background-color: #ECECEC;
	height:30px;
 	font-weight: bold;
 	font-size:13px;
 	text-align: center;
	border-bottom: 1px solid #000000;
	border-right: 1px solid #000000;
	font-family: sans-serif;
}

.itemInfo{
    line-height: 20px;
    font-family: sans-serif;
}

.showBorder{
	margin:auto;
	border:0px;
	border-bottom:1px solid red;
	height:20px;
	width: 85px;
	color: green;
	text-align: right;
}

.budgetItem {
	margin:auto;
	border: 0px;
	height:20px;
	width: 85px;
	color: green;
	text-align: right;
}
</style>
</head>
<body>
	<div style="margin: 5px;">
		<%@ include file="/common/messages.jsp"%>
	</div>
    <div style="margin: 5px; font-family: sans-serif; font-size: 14px; text-align: left;">
        <b>部门</b>：${model.dept.name}&nbsp;&nbsp;
        <b>年度</b>：${model.year}年&nbsp;&nbsp;
        <b>预算额度</b>：<span style="color: red;">${model.amount}&nbsp;&yen;&nbsp;</span>
    </div>
    <s:form id="budgetForm" action="update.do" method="post" cssStyle="margin:5px;">
	  <s:hidden name="model.id" />
	  <table class="budgetTable" cellpadding="0" cellspacing="0">
	    <tr>
	      <th width="110">科目编码/名称</th>
	      <th width="50">季度</th>
	      <s:if test='model.btype == "month"'>
	      <th width="50">月份</th>
	      </s:if>
	      <th width="100">预算金额 &yen;</th>
	      <th width="100">第1次追加 &yen;</th>
	      <th width="100">第2次追加 &yen;</th>
	      <th width="100">第3次追加 &yen;</th>
	      <th width="100">第4次追加 &yen;</th>
	      <th width="100">最终预算额 &yen;</th>
	    </tr>
	    <s:iterator value="model.budgetItems" var="bi">
	      <tr>
	        <td width="110" valign="middle" style="border-bottom: 2px solid;">
	          <div class="itemInfo">
	            &nbsp;<a href="#" title="科目名称">${bi.item.name}</a><br>
	            &nbsp;<a href="#" title="科目编码">${bi.item.code}</a>
	          </div>
	          <div class="itemInfo" style="text-align: right; color: green; font-weight: bold; border-top: 1px dashed #CCC;">
	            &nbsp;小计：${bi.amount}&nbsp;&yen;
	          </div>
	        </td>
	        <td colspan="8" style="padding: 0px;">
	          <table cellpadding="0" cellspacing="0" align="center">
	            <s:iterator value="#attr.bi.bims" var="bim">
	              <tr>
	                <td width="50" align="center" style="color: blue;">
	                  ${bim.qtr}季&nbsp;
	                </td>
	                <s:if test='model.btype == "month"'>
			        <td width="50" align="right" style="color: blue;">
			          ${bim.month}月&nbsp;&nbsp;
			        </td>
			        </s:if>
			        <td width="100" align="center">
			          <input type="hidden" name="bimIds" value="${bim.id}" class="budgetItem">
			          <input type="text" name="amount_${bim.id}" value="${bim.amount}" maxlength="12" class="budgetItem" onfocus="showBorder(this)" onblur="hiddenBorder(this)">
			        </td>
			        <td width="100" align="center">
			          <input type="text" name="add1th_${bim.id}" value="${bim.add1th}" maxlength="12" class="budgetItem" onfocus="showBorder(this)" onblur="hiddenBorder(this)">
			        </td>
			        <td width="100" align="center">
			          <input type="text" name="add2th_${bim.id}" value="${bim.add2th}" maxlength="12" class="budgetItem" onfocus="showBorder(this)" onblur="hiddenBorder(this)">
			        </td>
			        <td width="100" align="center">
			          <input type="text" name="add3th_${bim.id}" value="${bim.add3th}" maxlength="12" class="budgetItem" onfocus="showBorder(this)" onblur="hiddenBorder(this)">
			        </td>
			        <td width="100" align="center">
			          <input type="text" name="add4th_${bim.id}" value="${bim.add4th}" maxlength="12" class="budgetItem" onfocus="showBorder(this)" onblur="hiddenBorder(this)">
			        </td>
			        <td width="100" align="right" style="border-right:0px; color: red; font-weight: bold; font-size: 13px;">
			          ${bim.finalAmount}&nbsp;&yen;&nbsp;&nbsp;</td>
	              </tr>
	            </s:iterator>
	          </table>
	        </td>
	      </tr>
	    </s:iterator>
	  </table>
	  <input type="submit" value="保存预算" class="button" style="margin-top: 10px;">
	</s:form>
<script type="text/javascript">
  function showBorder(obj){
	  obj.className = 'showBorder';
  }
  
  function hiddenBorder(obj){
	  obj.className = 'budgetItem';
  }
</script>
</body>
</html>